package org.qiaice.controller;

import lombok.RequiredArgsConstructor;
import org.qiaice.result.Result;
import org.qiaice.service.CommonService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping(value = "/admin/common", produces = "application/json; charset=utf-8")
@RequiredArgsConstructor
public class CommonController {

    private final CommonService commonService;

    @PostMapping(value = "/upload")
    public Result<Object> upload(MultipartFile file) {
        String url = commonService.upload(file);
        return Result.ok(url);
    }
}
